/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_HTTP_URI_H
#define MK_HTTP_URI_H
#include "MkUtil/MkTypes.h"

class MkApi CMkHttpUri
{
public:
    CMkHttpUri();
    virtual ~CMkHttpUri();
    const MkMapString& GetParams() const { return m_Params; }
    const MkString& GetUriPath() const { return m_UriPath; }

    Uint32 ParseUri(const MkString& Uri);
    Uint32 AddParam(const MkString& Key, const MkString& Value);
    Uint32 SetUriPath(const MkString& UriPath);
    void SetMapParam(const MkMapString& MapParam) { m_Params = MapParam; }

    Uint32 ToString(MkString& strUri);
    void Release();
protected:
private:
    Uint32 UriEncode(const MkString& Uri, BOOL SpaceAsPlus, MkString& EncodeUri);
    Uint32 UriDecode(const MkString& Uri, BOOL DecodePlus, MkString& DecodeUri);

private:
    MkMapString                  m_Params;
    MkString                     m_UriPath;  //not encode to ascii
};


#endif